<template>
    <div :id="id" :style="{width,height}"></div>
</template>

<script>
import echarts from "echarts"
export default {
  props:['width','height','id'],
  mounted(){
    const myChart = echarts.init(document.getElementById(this.id));
    // 绘制图表
    var option = {
        tooltip : {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        legend: {
            type: 'scroll',
            orient: 'vertical',
            right: 10,
            top: 20,
            bottom: 20,
            data: ['软件互联网','教育培训','金融','广告媒体','服务娱乐','其他'],

        },
        series : [
            {
                name: '行业',
                type: 'pie',
                radius : '55%',
                center: ['40%', '50%'],
                data:[
                {value:335, name:'软件互联网'},
                {value:310, name:'教育培训'},
                {value:234, name:'金融'},
                {value:135, name:'广告媒体'},
                {value:1548, name:'服务娱乐'},
                {value:234, name:'其他'},
              ],
              
            }
        ]
    };


    
    myChart.setOption(option)
  }
}
</script>

<style>

</style>